<?php
declare (strict_types = 1);

namespace app\api\controller;

use think\facade\Db;
use app\api\model\MenuModel;
use think\facade\Session;

class Index
{

	/**
	 * Created by Ailcc.com
     * 2021-11-14 12:00:00 沛霖主页
	 */
    public function index()
    {
        $admin_id = Session::get('admin_id');
        if(empty($admin_id)){
            return json(['code'=>1, 'msg'=>'请先登录','data'=>[]]);
        }
        
        $info = MenuModel::getTree();
        return my_response(0,'',$info);
    }
    
    /* info */
    public function info(){
        $user = Db::name('user')->find();
        $this->assign('user',$user);
        $this->getSide();
        return $this->fetch();
        
    }

}
